package com.bvgol.examples.springbootLogback.controller;

import com.bvgol.examples.springbootLogback.common.Log;
import com.bvgol.examples.springbootLogback.common.R;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@RestController
@RequestMapping("/api")
public class ApiController {
    @Log("hhhhhhhhhhhhhhhhhh")
    @GetMapping
    public R<String> addLog(@RequestParam(value = "param1", required = false) String param1) {
        return R.success("你好，这段话将被日志记录");
    }

    /**
     * @Classname ApiController
     * @param
     * @return
     * @Description TODO
     * @Date 2022/4/13 13:44
     * @auther by GUOCHEN
     */
     @GetMapping("logNOAnnotation/{id}")
     public Object logNOAnnotation(@PathVariable("id") String id){
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-mm-dd HH:MM:ss.SSS"));
     }

}
